/**
 * 应付台账明细-已完成
 */


app.controller('formSelfCtrl', ['$scope', '$http', FormSelfController]);
function FormSelfController($scope, $http){

	$scope.changeValueMap = function(field) {
		if(field == 'unitPrice' || field == 'quantity' || field == 'proxyPrice'){
			var costPrice = parseFloat( $scope.valueMap["costPrice"]); // 成本价
			var quantity = parseFloat( $scope.valueMap["quantity"]); // 数量
			var proxyPrice = parseFloat( $scope.valueMap["proxyPrice"]); // 代理价

			if((costPrice || costPrice==0) && (quantity || quantity==0)){
				var totalPrice = costPrice*quantity;
				$scope.valueMap['totalPrice'] = totalPrice.toFixed(2);
			}
			if((quantity || quantity==0) && (proxyPrice || proxyPrice==0)){
				var proxyTotalPrice = proxyPrice*quantity;
				$scope.valueMap['proxyTotalPrice'] = proxyTotalPrice.toFixed(2);
			}
		}
	}

}


